package com.demo.rabbitmq.producer;

import jakarta.annotation.Resource;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
public class MultiServerProducer {

    @Resource
    private RabbitTemplate firstRabbitTemplate;
    @Resource
    private RabbitTemplate secondRabbitTemplate;

    public void firstRabbitMQSend(String message) {
        firstRabbitTemplate.convertAndSend("multi_server_exchange1", "multi_server_queue_routing_key1", message);
    }

    public void secondRabbitMQSend(String message) {
        secondRabbitTemplate.convertAndSend("multi_server_exchange2", "multi_server_queue_routing_key2", message);
    }
}
